<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/common/common.jsp"%>
<%@ page import="com.chanyachting.emall.util.*" %>
<%@ page import="java.util.*" %>

<%@ page import="com.chanyachting.emall.domain.*" %>
<%@ page import="com.chanyachting.emall.util.RequestUtil" %>
<%@ page import="com.chanyachting.emall.service.*" %>
<%@ page import="com.chanyachting.emall.serviceImpl.*" %>


<%

RequestUtil ru=new RequestUtil(request);

//获得商品类型
String productType=ru.getParameter("type","00").trim();
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="" /> 
<meta name="description" content="" />
<link href="css/import.css" type="text/css" rel="stylesheet" />
<title></title>

<script type="text/javascript" src="<%=root %>/js/jquery-1.3.2.min.js" charset="utf-8">//ADCRM</script>
<script type="text/javascript" src="<%=root %>/js/jquery.form.js" charset="utf-8">//ADCRM</script>

<script language="javascript" type="text/javascript">

	$(function(){

		$.ajaxSetup ({
		    cache: false //关闭AJAX相应的缓存
		});

		});

</script>


</head>

<body>
<div class="tab_box">
	<div class="tab_menu">
    	
        <a href="" class="current"><%
        		if ("00".equals(productType)) {
        			out.print("管理普通商品");
        		} else if ("01".equals(productType)) {
        			out.print("管理游艇销售");
        		} else if ("02".equals(productType)) {
        			out.print("管理游艇租赁");
        		} else if ("03".equals(productType)) {
        			out.print("管理码头俱乐部");
        		} else if ("04".equals(productType)) {
        			out.print("管理游艇展览");
        		} else if ("05".equals(productType)) {
        			out.print("管理帆船赛事");
        		}
        	%></a>
  
    </div>
	<div class="tab_submenu">
	  <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="50%"><div class="mu_title"><a href="product_nomal_list.jsp?type=<%=productType %>">产品展示中</a>｜
          <a href="product_nomal_under_list.jsp?type=<%=productType %>">待上架</a>｜
          <a href="product_nomal_public_list.jsp?type=<%=productType %>">推荐中</a>
          </div></td>
          <td align="right">&nbsp;</td>
        </tr>
      </table>
	</div>
</div>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="yes_border">
  <tr>
    <th height="36" colspan="6" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="no_border">
      <tr>
        <td width="15%" height="36" align="center"><label></label>
              <input type="submit" name="button" id="button" value=" 下 架 " />
              <input type="submit" name="button2" id="button2" value=" 删 除 " /></td>
        <td align="center">&nbsp;</td>
        <td width="15%" align="center">&nbsp;</td>
      </tr>
    </table></th>
  </tr>
  <tr>
    <td colspan="6" align="center" bgcolor="#E7E7E7"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="no_border">
      <tr>
        <td width="15%" align="center"><label>
          <input type="checkbox" name="checkbox2" id="checkbox2" />
          </label>
          全选本页产品信息</td>
        <td align="center">&nbsp;</td>
        <td width="15%" align="center">本页显示 10条产品信息</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <th width="15%" align="center">编号</th>
    <th align="center">商品名称</th>
    <th width="10%" align="center"><p>展示剩余天数</p></th>
    <th width="15%" align="center">今日刷新</th>
    <th width="15%" align="center">统计次数</th>
    <th width="15%" align="center">操作</th>
  </tr>
  
  <%
  	
  
  //从session中获得公司对象
	
	Company company=(Company)ru.getSessionObject(CompanyService.COMPANY_IN_SESSION,new Company());
	
  CompanyproductService compService = new CompanyproductServiceImpl();
	List<Companyproduct> prodList=compService.getRecommendCompanyproductByCompany(company,productType);
	

  %>
  
  
  <%
  	if(prodList!=null && prodList.size()>0){
  		
  		Companyproduct cp=null;
  		
  		for(int i=0;i<prodList.size();i++){
  			
  			cp=(Companyproduct)prodList.get(i);
  %>
  <tr>
    <td align="center"><input type="checkbox" name="checkbox2" id="checkbox4" /><%=cp.getId() %></td>
    <td><%= cp.getName() %></td>
    <td align="center"><%= cp.getMaturityTime() %></td>
    <td align="center">
    <%
    	boolean canReflesh = false;
    	
    	String refleshDate = cp.getRefreshDate();
    	String today = DateUtil.getToday();
    	if (refleshDate != null && !"".equals(refleshDate)) {
    		refleshDate = refleshDate.substring(0,10);
    		today = today.substring(0,10);
    		
    		if (!today.equals(refleshDate)) {
    			canReflesh = true;
    			out.println("可刷新");
    		}
    	} else {
    		canReflesh = true;
			out.println("可刷新");
    	}
    	if (!canReflesh) {
    		out.println("已刷新");
    	}
    %></td>
    <td align="center"><%= cp.getAccessNumber() %></td>
    <td align="center">
    	<a href="#">预览</a>　
    	<%
    		if (canReflesh) {
    	%>
    	<a href="<%=root %>/memberBackend/nomalProductRefresh.do?cpid=<%=cp.getId() %>&type=<%=productType %>" >刷新</a>
    	<%
    		}
    	%>
    	<a href="<%=root %>/memberBackend/nomalProductUnPublic.do?cpid=<%=cp.getId() %>&type=<%=productType %>">不推荐</a>
    </td>
  </tr>
  
  <%
  		}
  		
  	}
  
  %>
  
 
  <tr>
    <td colspan="6" bgcolor="#E7E7E7"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="no_border">
      <tr>
        <td width="15%" align="center"><label>
          <input type="checkbox" name="checkbox2" id="checkbox2" />
          </label>
          全选本页产品信息</td>
        <td align="center">&nbsp;</td>
        <td width="15%" align="center">本页显示 10条产品信息</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="6"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="no_border">
      <tr>
        <td width="15%" height="36" align="center"><label></label>
              <input type="submit" name="button2" id="button7" value=" 下 架 " />
              <input type="submit" name="button2" id="button8" value=" 删 除 " /></td>
        <td align="center">&nbsp;</td>
        <td width="15%" align="center">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>
<p>&nbsp;</p>
</body>
</html>

